package com.lt.lumentracks.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class ExecutionTimeAspect {

    // 切点表达式：匹配特定包或类下的方法（示例为com.example.service包下所有方法）
//    @Around("execution(* com.lt.lumentracks.service.Impl.PostServiceImpl.*(..))")
//    public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
//        long startTime = System.currentTimeMillis();
//        Object result = joinPoint.proceed(); // 执行目标方法
//        long endTime = System.currentTimeMillis();
//
//        String methodName = joinPoint.getSignature().getName();
//        System.out.println("方法 [" + methodName + "] 执行耗时: " + (endTime - startTime) + "ms");
//        return result;
//    }
}
